<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset='utf-8'>
  <link href="../css/zui.min.css" rel="stylesheet">
  <link href="../css/example.css" rel="stylesheet">

  <script src="../../assets/jquery.js"></script>
  <script src="../../dist/js/zui.min.js"></script>


  <link href="../css/example.css" rel="stylesheet">




  <script src="../assets/js/example.js"></script>
</head>
<body>
  <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <a class="navbar-brand" href="#">ZUI</a>
    </div>
    <div class="collapse navbar-collapse" id="navbar">
      <ul class="nav navbar-nav">
        <li class="dropdown">
          <a href="#" class="dropdown-toggle" data-toggle="dropdown"><span id="navbarCurrent">examples</span> <b class="caret"></b></a>
          <ul class="dropdown-menu" role="menu">
            <li><a href="alerts.html">alerts</a></li>
            <li><a href="article.html">article</a></li>
            <li><a href="breadcrumb.html">breadcrumb</a></li>
            <li><a href="button-groups.html">button-groups</a></li>
            <li><a href="buttons.html">buttons</a></li>
            <li><a href="cards.html">cards</a></li>
            <li><a href="carousel.html">carousel</a></li>
            <li><a href="chosen.html">chosen</a></li>
            <li><a href="collapse.html">collapse</a></li>
            <li><a href="colorset.html">colorset</a></li>
            <li><a href="comment.html">comment</a></li>
            <li><a href="dropdowns.html">dropdowns</a></li>
            <li><a href="forms.html">forms</a></li>
            <li><a href="grid.html">grid</a></li>
            <li><a href="icons.html">icons</a></li>
            <li><a href="input-groups.html">input-groups</a></li>
            <li><a href="kindeditor.html">kindeditor</a></li>
            <li><a href="labels.html">labels</a></li>
            <li><a href="lightbox.html">Lightbox</a></li>
            <li><a href="list-group.html">list-group</a></li>
            <li><a href="list.html">list</a></li>
            <li><a href="modals.html">modals</a></li>
            <li><a href="navbars.html">navbars</a></li>
            <li><a href="navs.html">navs</a></li>
            <li><a href="pager.html">pager</a></li>
            <li><a href="panels.html">panels</a></li>
            <li><a href="popovers.html">popovers</a></li>
            <li><a href="progress.html">progress</a></li>
            <li><a href="tables.html">tables</a></li>
            <li><a href="tabs.html">tabs</a></li>
            <li><a href="textbox.html">textbox</a></li>
            <li><a href="tooltip.html">tooltip</a></li>
            <li><a href="type.html">type</a></li>
          </ul>
        </li>
        <li id="navbarNext"><a href="###">NEXT <i class="icon-angle-right icon-large"></i></a></li>
      </ul>
    </div>
  </nav>
<article>
  <section id='modals' class="page-section">
    <h1>模态框</h1>

    <h3>类型</h3>
    <h4>基本类型</h4>
    <p>启动方式一：通过在一个起控制器作用的页面元素（例如，按钮）上设置data-toggle="modal"，并使用data-target="#foo"或href="#foo"指向特定的模态框即可。</p>
    <p>启动方式二：只需一行JavaScript代码，即可通过id myModal调用模态框： $('#myModal').modal(options) </p>
    <button class="btn btn-primary" data-toggle="modal" data-target="#myModal">实例</button>
    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalTitle" aria-hidden="true">
      <div class="modal-dialog">
        <div class="modal-content">
          <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
            <h4 class="modal-title" id="myModalTitle">
              <code>标题：div.modal > div.modal-dialog > div.modal-content > div.modal-header > h4.modal-title</code>
            </h4>
          </div>
          <div class="modal-body">
            <h5><code>内容：div.modal > div.modal-dialog > div.modal-content > div.modal-body</code></h5>
          </div>
          <div class="modal-footer">
            <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
            <button type="button" class="btn btn-primary">保存</button>
          </div>
        </div><!-- /.modal-content -->
      </div><!-- /.modal-dialog -->
    </div><!-- /.modal -->

    <h4>框架对话框触发器</h4>
    <a href="alerts.html" data-toggle='modal' class='btn btn-success'><i class='icon-heart'></i> 打开框架对话框</a>

    <h3>变化</h3>
    <h4>选项</h4>
    <p>aria-labelledby="myModalTitle"属性指向模态框标题。</p>
    <p>aria-hidden="true"告诉辅助性工具略过模态框的DOM元素。</p>
    <p>aria-describedby='myModelBody'属性用以指向描述信息。</p>
    <p>通过对div.modal增加data-*选项来改变模态对话框。或通过js改变$('#myModal').modal({ keyboard: false })</p>
    <table class="table table-bordered table-striped">
      <thead>
       <tr>
         <th style="width: 80px;">名称</th>
         <th style="width: 80px;">类型</th>
         <th style="width: 80px;">默认值</th>
         <th>描述</th>
       </tr>
      </thead>
      <tbody>
       <tr>
         <td>backdrop</td>
         <td>boolean/static</td>
         <td>true</td>
         <td>
           <p><code>true</code>时，添加一个背景元素，且点击外部区域将其关闭。</p>
           <p><code>false</code>时，不会添加背景元素，且点击外部区域不会关闭。</p>
           <p><code>static</code>时，添加一个背景元素，且点击外部区域不会关闭。</p>
         </td>
       </tr>
       <tr>
         <td>keyboard</td>
         <td>boolean</td>
         <td>true</td>
         <td>
           <p><code>true</code>时，按esc键关闭模态框。</p>
           <p><code>false</code>时，按esc不会关闭模态框。</p>
         </td>
       </tr>
       <tr>
         <td>show</td>
         <td>boolean</td>
         <td>true</td>
         <td>
           <p><code>true</code>时，初始化时即显示模态对话框。</p>
           <p><code>true</code>时，初始化时不显示模态对话框。</p>
         </td>
       </tr>
       <tr>
         <td>remote</td>
         <td>path</td>
         <td>false</td>
         <td><p>如果提供了远程url地址，就会通过 jQuery的<code>load</code>方法加载内容并注入到<code>.modal-body</code>中。如果你使用的是data属性api，你还可以使用<code>href</code>标签指定远程数据源。 </p></td>
       </tr>
      </tbody>
    </table>
    <h4>方法和事件</h4>
    <table class="table table-bordered table-striped">
      <thead>
       <tr>
         <th style="width: 80px;">方法</th>
         <th>例子</th>
         <th>描述</th>
       </tr>
      </thead>
      <tbody>
       <tr>
         <td>.modal(options)</td>
         <td><code>$('#myModal').modal({ keyboard: false })</code></td>
         <td>让你指定的内容变成一个模态对话框。接受一个可选的参数object.</td>
       </tr>
       <tr>
         <td>.modal('toggle')</td>
         <td><code>$('#myModal').modal('toggle')</code></td>
         <td>手动打开或隐藏一个模态对话框。</td>
       </tr>
       <tr>
         <td>.modal('show')</td>
         <td><code>$('#myModal').modal('show')</code></td>
         <td>手动打开一个模态对话框。</td>
       </tr>
       <tr>
         <td>.modal('hide')</td>
         <td><code>$('#myModal').modal('hide')</code></td>
         <td>手动隐藏一个模态对话框。</td>
       </tr>
      </tbody>
    </table>
    <table class="table table-bordered table-striped">
      <thead>
       <tr>
         <th style="width: 80px;">事件</th>
         <th>使用</th>
         <th>描述</th>
       </tr>
      </thead>
      <tbody>
       <tr>
         <td>show.bs.modal</td>
         <td><code>$('#myModal').on('show.bs.modal', function () { // do something… })</code></td>
         <td>当<code>show</code>方法被调用时，此事件将被立即触发。</td>
       </tr>
       <tr>
         <td>shown.bs.modal</td>
         <td><code>$('#myModal').on('shown.bs.modal', function () { // do something… })</code></td>
         <td>当模态对话框呈现到用户面前时（会等待过渡效果执行结束）此事件被触发。</td>
       </tr>
       <tr>
         <td>hide.bs.modal</td>
         <td><code>$('#myModal').on('hide.bs.modal', function () { // do something… })</code></td>
         <td>当<code>hide</code>方法被调用时，此事件将被立即触发。</td>
       </tr>
       <tr>
         <td>hidden.bs.modal</td>
         <td><code>$('#myModal').on('hidden.bs.modal', function () { // do something… })</code></td>
         <td>当模态对话框被隐藏（而且过渡效果执行完毕）之后，此事件将被触发。</td>
       </tr>
      </tbody>
    </table>

    <h4>改变模态框大小</h4>
    <p>通过重新定义.modal-dialog宽度<code>.modal-dialog {width:*}</code>来改变模态框大小</p>
    <style>#resizedModal .modal-dialog{width:50%;}</style>
    <button class="btn btn-primary" data-toggle="modal" data-target="#resizedModal">width:50%</button>
    <div class="modal" id="resizedModal" tabindex="-1" role="dialog" aria-labelledby="resizedModalTitle" aria-hidden="true">
      <div class="modal-dialog">
        <div class="modal-content">
          <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
            <h4 class="modal-title" id="resizedModalTitle"> 标题 </h4>
          </div>
          <div class="modal-body">
            <h5>通过重新定义.modal-dialog宽度<code>.modal-dialog {width:*}</code>来改变模态框大小</h5>
          </div>
          <div class="modal-footer">
            <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
            <button type="button" class="btn btn-primary">保存</button>
          </div>
        </div><!-- /.modal-content -->
      </div><!-- /.modal-dialog -->
    </div><!-- /.modal -->
    <h4>载入效果</h4>
    <p>目前有div.modal.fade和div.modal.in效果，需要<a target='_blank' href='http://v2.bootcss.com/javascript.html#transitions'>transition.js</a>支持。</p>
    <button class="btn btn-primary" data-toggle="modal" data-target="#tsModal">fade效果</button>
    <div class="modal fade" id="tsModal" tabindex="-1" role="dialog" aria-labelledby="tsModalTitle" aria-hidden="true">
      <div class="modal-dialog">
        <div class="modal-content">
          <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
            <h4 class="modal-title" id="tsModalTitle">标题</h4>
          </div>
          <div class="modal-body">
            <p>目前有div.modal.fade和div.modal.in效果，需要<a target='_blank' href='http://v2.bootcss.com/javascript.html#transitions'>transition.js</a>支持。</p>
          </div>
          <div class="modal-footer">
            <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
            <button type="button" class="btn btn-primary">保存</button>
          </div>
        </div><!-- /.modal-content -->
      </div><!-- /.modal-dialog -->
    </div><!-- /.modal -->

  </section>
</article>
  </body>
</html>

